import {  useEffect, useCallback } from "react";

export function useWinEventLis(eventType: string, listenerFn: (...args: any[]) => void) {

  const listener = useCallback((...args: any[]) => listenerFn(...args), [listenerFn]);
  
  useEffect(() => {
    window.addEventListener(eventType, listener);
    console.log('useWinEventLis')
    return () => {
      window.removeEventListener(eventType, listener);
      console.log('useWinEventLis-remo')
    };
  }, [eventType, listener]);
}